package thetvdb

import "fmt"

type Cache interface {
    HasSeries(id string) (series *Series, ok bool)
    PutSeries(series *Series)
}

type SessionCache struct {
    series map[string] *Series
}
func InitSessionCache() *SessionCache {
    cache := new(SessionCache)
    cache.series = map[string] *Series {}
    return cache
}
func (cache *SessionCache) HasSeries(id string) (series *Series, ok bool) {
    series, ok = cache.series[id]
    return
}

func (cache *SessionCache) PutSeries(series *Series) {
    cache.series[series.Id] = series
}

func (cache *SessionCache) String() (s string) {
    for _, series := range(cache.series) {
        s += fmt.Sprintln(series)
    }
    return
}



